package guestbook.gin;

import guestbook.rest.ApiGuestbookEntry;

import org.fusesource.restygwt.client.Resource;
import org.fusesource.restygwt.client.RestServiceProxy;

import com.google.gwt.core.client.GWT;
import com.google.inject.Inject;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;

public class ApiGuestbookEntryModule extends AbstractPresenterModule {

	String URL_PREFIX_RUNNING_ON_SERVER = "/";
	
	@Provides
	@Singleton
	@Inject
	public ApiGuestbookEntry provideApiGuestbookEntry() {

		ApiGuestbookEntry apiGuestbookEntry = GWT
				.create(ApiGuestbookEntry.class);
		RestServiceProxy restServiceProxy = ((RestServiceProxy) apiGuestbookEntry);

		restServiceProxy
				.setResource(new Resource(URL_PREFIX_RUNNING_ON_SERVER));

		return apiGuestbookEntry;
	}




	@Override
	protected void configure() {
		// TODO Auto-generated method stub
		
	}

}
